// 成绩统计页面
<template>
  <div id="grade">
    <!-- <div ref="box" class="box"></div> -->
    <!-- <div class="notFound" v-if="isNull">
      <i class="iconfont icon-LC_icon_tips_fill"></i><span>该考生未参加考试</span>
    </div> -->
    <div>
      <div>考生姓名：{{this.$route.query.studentName}}  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 考生id：{{this.$route.query.studentId}}</div>
      <br/><br/>
      <el-table :data="res" border>
      <el-table-column prop="subject" label="考试科目"></el-table-column>
      <el-table-column prop="etScore" label="分数"></el-table-column>
      <el-table-column prop="answerDate" label="考试时间"></el-table-column>
    </el-table>
    </div>
  </div>
</template>

<script>
export default {
  name: "grade",
  data() {
    return {
      isNull: false, //原始数据
      res: []
    }
  },
  mounted() {
    this.score();
  },
  methods: {
    score() {
      let studentId = this.$route.query.studentId
      this.$axios(`/api/score/${studentId}`).then(res => { //根据学生Id查询成绩
        if (res.length == 0) return this.isNull = true
        this.res = res.data.data
        console.log(res);
      })
    }
  }
};
</script>

<style lang="scss" scoped>
#grade {
  position: relative;
  padding: 0px 50px;
  .notFound {
    position: absolute;
    top: 0px;
    left: 0px;
  }
}
</style>
